home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / numeric.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  4.7 KB  |  166 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init()
  7. call createApp()
  8. call handleApp()
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rxmui.library")~=0 then exit
  14.     return
  15. /***********************************************************************/
  16. handleApp: procedure
  17.     ctrl_c=2**12
  18.     do forever
  19.         call NewHandle("APP","H",ctrl_c)
  20.         if and(h.signals,ctrl_c)>0 then exit
  21.         select
  22.             when h.event="QUIT" then exit
  23.             when h.event="NUM1" then say h.num1
  24.             otherwise interpret h.event
  25.         end
  26.     end
  27. /* never reached */
  28. /***********************************************************************/
  29. err: procedure expose sigl RxMUIError
  30. parse arg res
  31.     msg = ProgramName()":" GetRxMUIString(res) "in line" sigl-1
  32.     if RxMUIError~="RXMUIERROR" then msg = msg "["RxMUIError"]"
  33.     say msg
  34.     exit
  35. /***********************************************************************/
  36. createApp: procedure
  37.  
  38.     minv=0
  39.     maxv=100
  40.     defv=50
  41.  
  42.     app.Title="NumericExample"
  43.     app.Version="$VER: NumericExample 1.0 (5.7.2000)"
  44.     app.Copyright="©1999 by alfie"
  45.     app.Author="alfie"
  46.     app.Description="Numeric example"
  47.     app.Base="NUMERICEXAMPLE"
  48.     app.SubWindow="mwin"
  49.     app.num1=50
  50.  
  51.      mwin.ID="MWIN"
  52.      mwin.Title="Numeric example"
  53.      mwin.Contents="mgroup"
  54.  
  55.       mgroup.0="ng"
  56.        ng.class="group"
  57.        ng.frame="group"
  58.        ng.columns=2
  59.  
  60.         call child("ng",label("Levelmeter"))
  61.         call child("ng","lg","group")
  62.          lg.horiz=1
  63.          lg.0="levelmeter"
  64.           levelmeter.class="levelmeter"
  65.           levelmeter.min=minv
  66.           levelmeter.max=maxv
  67.           levelmeter.value=defv
  68.           levelmeter.label="Level"
  69.          lg.1=hvspace()
  70.  
  71.         call child("ng",label("_Knob"))
  72.         call child("ng","kg","group")
  73.          kg.horiz=1
  74.          kg.0="knob"
  75.           knob.class="knob"
  76.           knob.controlChar="k"
  77.           knob.min=minv
  78.           knob.max=maxv
  79.           knob.value=defv
  80.           knob.default=defv
  81.          kg.1=hvspace()
  82.  
  83.         call child("ng",label("Num button"))
  84.         call child("ng","nbg","group")
  85.          nbg.horiz=1
  86.          nbg.class="group"
  87.          nbg.0="nb"
  88.           nb.class="numericbutton"
  89.           nb.min=minv
  90.           nb.max=maxv
  91.           nb.value=defv
  92.          nbg.1=hvspace()
  93.  
  94.         call child("ng",label("_Slider"))
  95.         call child("ng","sl","slider")
  96.          sl.controlChar="s"
  97.          sl.min=minv
  98.          sl.max=maxv
  99.          sl.level=defv
  100.          sl.format="Value: %lx"
  101.  
  102.         call child("ng",label("Gauge"))
  103.         call child("ng","gg","group")
  104.           gg.0="gauge"
  105.            gauge.class="gauge"
  106.            gauge.frame="text"
  107.            gauge.FixHeightTxt="\n\n"
  108.            gauge.horiz=1
  109.            gauge.max=maxv
  110.            gauge.current=defv
  111.           gg.1=MakeObj(,"scale")
  112.  
  113.         call child("ng",label("Prop"))
  114.         call child("ng","prop","prop")
  115.            prop.frame="text"
  116.            prop.FixHeightTxt="\n\n"
  117.            prop.horiz=1
  118.            prop.entries=maxv
  119.            prop.first=0
  120.            prop.visible=defv
  121.  
  122.       mgroup.1="bg"
  123.        bg.class="group"
  124.        bg.horiz=1
  125.         bg.0=button("reset","_Reset")
  126.         bg.1=button("inc","_Increase")
  127.         bg.2=button("dec","_Decrease")
  128.  
  129.  
  130.  
  131.     res=NewObj("APPLICATION","APP")
  132.     if res~=0 then call err(res)
  133.  
  134.     call notify("app","num1","everytime","app","return","NUM1","triggerattr")
  135.     call notify("app","num1","everytime","app","return","NUM1","triggerattr")
  136.     call notify("knob","value","everytime","app","set","num1","triggervalue")
  137.  
  138.     call Notify("mwin","closerequest",1,"app","returnid","quit")
  139.  
  140.     call notify("knob","value","everytime","nb","set","value","triggervalue")
  141.     call notify("nb","value","everytime","sl","set","value","triggervalue")
  142.     call notify("sl","value","everytime","levelmeter","set","value","triggervalue")
  143.     call notify("levelmeter","value","everytime","knob","set","value","triggervalue")
  144.  
  145.     call notify("knob","value","everytime","gauge","set","current","triggervalue")
  146.  
  147.     call notify("knob","value","everytime","prop","set","visible","triggervalue")
  148.  
  149.     call notify("reset","pressed",0,"knob","setdefault")
  150.     call notify("inc","pressed",0,"knob","increase",1)
  151.     call notify("dec","pressed",0,"knob","decrease",1)
  152.  
  153.     call set("mwin","open",1)
  154.     call getattr("mwin","open","o")
  155.     if o=0 then do
  156.         say "can't open window"
  157.         exit
  158.     end
  159.  
  160.     return
  161. /***********************************************************************/
  162. halt:
  163. break_c:
  164.     exit
  165. /**************************************************************************/
  166.